// StrFuncs.h: interface for the StrFuncs class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_STRFUNCS_H__EE48BA9D_0FE8_477E_AE5B_10A4B3FB07DA__INCLUDED_)
#define AFX_STRFUNCS_H__EE48BA9D_0FE8_477E_AE5B_10A4B3FB07DA__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class StrFuncs  
{
public:
	static BOOL IsGBKFirstByte(const char *szBuf, int x)
	{
		const char *pc0 = szBuf;
		if((BYTE)pc0[x] > 0x80)
		{
			const char *pc = pc0;
			while(pc < pc0 + x)
			{
				pc = CharNext(pc);
			}
			return (pc == pc0 + x);
		}
		else
		{
			return FALSE;
		}
	}
	static BOOL IsGBKSecondByte(const char *szBuf, int x)
	{
		if(x)
		{
			return IsGBKFirstByte(szBuf, x - 1);
		}
		return FALSE;
	}

public:

	static CString ConvertCP(const CString& sText, UINT cpFrom, UINT cpTo);

	static void GBK2GB(char *szBuf);
	static void GB2GBK(char *szBuf);
	static void GBK2BIG5(char *szBuf);
	static void BIG52GBK(char *szBuf);
	
	static CString CommonChars(const CComBSTR& s1, const CComBSTR& s2);
	static CString RemoveChars(const CComBSTR& s1, const CComBSTR& s2);
	static CString UniqueCharsAndSort(const CComBSTR& bs);

	static void Split(const CString &sText, const CString &sSep, CStringArray& rsa);

	StrFuncs();
	~StrFuncs();

};

#endif // !defined(AFX_STRFUNCS_H__EE48BA9D_0FE8_477E_AE5B_10A4B3FB07DA__INCLUDED_)
